//
//  GiftCell.m
//  linktuIOS
//
//  Created by 章为 on 16/5/12.
//  Copyright © 2016年 张伟. All rights reserved.
//

#import "GiftCell.h"
#import "giftModel.h"
#import "UIButton+WebCache.h"
@interface GiftCell ()
@property (weak, nonatomic) IBOutlet UIButton *IocnButton;
@property (weak, nonatomic) IBOutlet UILabel *nameLable;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *WConstant;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *HConstant;

@property (weak, nonatomic) IBOutlet UIButton *damainIconButton;

@end

@implementation GiftCell

- (void)awakeFromNib {
    [super awakeFromNib];

    self.WConstant.constant = RelativeValue(60);
    self.HConstant.constant = RelativeValue(60);
    // Initialization code
}

-(void)setModel:(giftModel *)model
{
    _model = model;
    self.nameLable.textColor = [UIColor whiteColor];
    self.nameLable.text = [NSString stringWithFormat:@"%g  ", model.price];
    [self.IocnButton sd_setImageWithURL:[NSURL URLWithString:model.image] forState:UIControlStateNormal placeholderImage:nil];
    self.selectedButton.selected = [(NSString *)model.isSelected isEqualToString:@"1"] ? YES : NO;
}
-(void)setTextColor:(UIColor *)textColor
{
    _textColor = textColor;
    self.nameLable.textColor = textColor;
}
-(void)setIconImageStr:(NSString *)iconImageStr
{
    _iconImageStr = iconImageStr;
    [self.damainIconButton setImage:[UIImage imageNamed:iconImageStr] forState:UIControlStateNormal];
}
- (IBAction)ButClick:(UIButton *)sender {
    
    if(self.selectedButtonBlcok)
    {
        self.selectedButtonBlcok(self);
    }
}
@end
